<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<title></title>
	<meta name="generator" content="LibreOffice 6.3.3.2.0 (Linux)"/>
	<meta name="author" content="Georg Potthast"/>
	<meta name="created" content="2017-01-05T00:00:00.019172240"/>
	<meta name="changed" content="2020-04-18T09:41:17.327281926"/>
	<style type="text/css">
		@page { size: 21cm 29.7cm; margin: 2cm }
		p { margin-bottom: 0.21cm; line-height: 115%; background: transparent }
		h2 { margin-top: 0.35cm; margin-bottom: 0.21cm; background: transparent; page-break-after: avoid }
		h2.western { font-family: "Arial", sans-serif; font-size: 14pt; font-style: italic; font-weight: bold }
		h2.cjk { font-family: "Microsoft YaHei"; font-size: 14pt; font-style: italic; font-weight: bold }
		h2.ctl { font-family: "Lucida Sans"; font-size: 14pt; font-style: italic; font-weight: bold }
		td p { margin-bottom: 0cm; background: transparent }
		a:link { color: #000080; so-language: zxx; text-decoration: underline }
	</style>
</head>
<body lang="de-DE" link="#000080" vlink="#800000" dir="ltr"><p style="page-break-before: always">
<br/>
<br/>

</p>
<table width="718" cellpadding="4" cellspacing="0">
	<col width="710"/>

	<tr>
		<td width="710" valign="top" style="border: none; padding: 0cm"><h2 class="western" style="font-variant: normal; font-style: normal">
			Line editing and autocompletion with the ELKS shell</h2>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">ELKS
			uses the ash or Almquist shell. This is the port for ELKS which
			was ported from the MINIX version in 1998.</font></p>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">This
			had commented code to include the GNU Readline library or the
			editline library (by Simmule Turner and Rich Salz). These
			libraries provide a set of functions that allow users to edit
			command lines as they are typed in. They also include additional
			functions to maintain a list of previously-entered command lines,
			to recall and perhaps reedit those lines. Both libraries were not
			used with ELKS, probably because of memory space requirements.</font></p>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">I
			now added these functions using the small Linenoise library by
			Salvatore Sanfilippo from Sicily. It is available on GitHub at
			https://github.com/antirez/linenoise . This library was reduced in
			size and adapted to ELKS and its ash shell port.</font></p>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">This
			library adds the following commands to allow for line editing and
			command history:</font></p>
			<table width="692" cellpadding="4" cellspacing="0">
				<col width="187"/>

				<col width="487"/>

				<tr valign="top">
					<td width="187" style="border-top: 1px solid #000000; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p>
						<font face="Arial, sans-serif"><b>Cursor-Up</b></font></p>
					</td>
					<td width="487" style="border-top: 1px solid #000000; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0.1cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Search backward in the history.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p style="margin-bottom: 0.5cm">
						<font face="Arial, sans-serif"><b>Cursor-Down</b></font></p>
						<p><br/>

						</p>
					</td>
					<td width="487" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Search forward in the history.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p>
						<font face="Arial, sans-serif"><b>Cursor-Left / Control-b</b></font></p>
					</td>
					<td width="487" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Move back one character.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p>
						<font face="Arial, sans-serif"><b>Cursor-Right / Control-f</b></font></p>
					</td>
					<td width="487" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Move forward one character.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p>
						<font face="Arial, sans-serif"><b>Backspace</b></font></p>
					</td>
					<td width="487" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Delete the character to the left
						of the cursor.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p>
						<font face="Arial, sans-serif"><b>DEL</b></font></p>
					</td>
					<td width="487" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Delete the character underneath
						the cursor.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p style="margin-bottom: 0.5cm">
						<font face="Arial, sans-serif"><b>Printing characters</b></font></p>
						<p><br/>

						</p>
					</td>
					<td width="487" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Insert the character into the
						line at the cursor position.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p>
						<font face="Arial, sans-serif"><b>Home / Control-a</b></font></p>
					</td>
					<td width="487" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Move to the start of the line.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p>
						<font face="Arial, sans-serif"><b>End / Control-e</b></font></p>
					</td>
					<td width="487" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Move to the end of the line.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p>
						<font face="Arial, sans-serif"><b>Control-u</b></font></p>
					</td>
					<td width="487" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Delete entire line.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p>
						<font face="Arial, sans-serif"><b>Control-l</b></font></p>
					</td>
					<td width="487" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Clear the screen, reprinting the
						current line at the top.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0cm; padding-left: 0.1cm; padding-right: 0cm"><p>
						<font face="Arial, sans-serif"><b>Control-k</b></font></p>
					</td>
					<td width="487" style="border-top: none; border-bottom: none; border-left: 1px solid #000000; border-right: 1px solid #000000; padding: 0cm 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Delete the text from the current
						cursor position to the end of the line.</font></p>
					</td>
				</tr>
				<tr valign="top">
					<td width="187" style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p style="margin-bottom: 0.5cm">
						<font face="Arial, sans-serif"><b>Control-w</b></font></p>
						<p><br/>

						</p>
					</td>
					<td width="487" style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm"><p style="font-weight: normal">
						<font face="Arial, sans-serif">Delete from the cursor to the
						previous word.</font></p>
					</td>
				</tr>
			</table>
			<p style="margin-bottom: 0.5cm"><font face="Arial, sans-serif"><b>Autocompletion</b></font></p>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">Linenoise
			features autocompletion (or TAB completion) which has been adapted
			for ELKS.</font></p>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">a)
			if you enter one or more letters on the command line and press
			TAB, the shell will list the programs in the /bin directory that
			begin with these letters on the screen and put the first one of
			these on the command line. If only one program matches the letters
			entered, there will be no list shown and just this program will be
			put on the command line.</font></p>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">You
			can select the program which is put on the command line by
			pressing enter or enter TAB again to get the next program in the
			list being displayed on the command line which you can then select
			with enter.</font></p>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">b)
			if you enter &quot;./&quot; on the command line and press TAB, the
			shell will list the programs in the current directory and show the
			first of these on the command line. You can either select that
			with enter or press TAB to put the next program on the command
			line.</font></p>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">c)
			if you enter e.g. ls, cat, vi etc. plus a blank and press TAB, the
			shell will list all the files in the current directory which are
			not executables on the screen and put the first one on the command
			line. You can select that with enter or press TAB to get the next
			one on the command line. This way you can select a file to use
			with ls, cat or vi using autocompletion.</font></p>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">d)
			if you enter &quot;cd &quot; on the command line and press TAB,
			the shell will list all the directories in the current directory
			and put the first of them on the command line. If you press enter
			you can move into that directory, or select &quot;cd ..&quot; from
			the list by pressing TAB to move up one directory. </font>
			</p>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">If
			you enter &quot;cd /&quot; and press TAB, the shell will display
			all the directories in the root directory. If you press TAB again
			you can select one of these.</font></p>
			<p style="margin-bottom: 0.5cm; font-weight: normal"><font face="Arial, sans-serif">18th
			of April 2020 Georg Potthast</font></p>
			<p style="margin-bottom: 0.5cm"><br/>
<br/>

			</p>
		</td>
	</tr>
</table>
<p><br/>
<br/>

</p>
</body>
</html>